﻿using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ServerMonitor
{
     public class DeviceBean
    {
        private string deviceName;
        private string ipAddress;
        private int port;
        private string userName;
        private string password;
        private string[] monitorStrs;
        private long reslutTotalMemory;
        private long resultAvailableMemory;
        private int resultCpuLoad;
        private int resultMemoryUsage;
        private long resultTotalDiskSpace;
        private long resultFreeDiskSpace;
        private int resultDiskUsage;
        private long staticTotalMemory;
        private long staticAvailableMemory;
        private int staticCpuLoad;
        private int staticMemoryUsage;
        private bool isConnected;
        private string updateTime;
        private static long gbParam = 1024 * 1024 * 1024;

        public string getDataWithGB(long data)
        {
            string result = "0GB";
            try
            {
                double resultNum = Math.Round((double)((data / gbParam) * 100)) / 100;
                result = resultNum + "GB";
            }
            catch (Exception)
            {

            }
            return result;
        }

        public string DeviceName
        {
            get
            {
                return deviceName;
            }

            set
            {
                deviceName = value;
            }
        }

        public string IpAddress
        {
            get
            {
                return ipAddress;
            }

            set
            {
                ipAddress = value;
            }
        }

        [JsonIgnore]
        public int Port
        {
            get
            {
                return port;
            }

            set
            {
                port = value;
            }
        }

        [JsonIgnore]
        public string UserName
        {
            get
            {
                return userName;
            }

            set
            {
                userName = value;
            }
        }

        [JsonIgnore]
        public string Password
        {
            get
            {
                return password;
            }

            set
            {
                password = value;
            }
        }

        [JsonIgnore]
        public string[] MonitorStrs
        {
            get
            {
                return monitorStrs;
            }

            set
            {
                monitorStrs = value;
            }
        }

        public long ReslutTotalMemory
        {
            get
            {
                return reslutTotalMemory;
            }

            set
            {
                reslutTotalMemory = value;
            }
        }

        public long ResultAvailableMemory
        {
            get
            {
                return resultAvailableMemory;
            }

            set
            {
                resultAvailableMemory = value;
            }
        }

        public int ResultCpuLoad
        {
            get
            {
                return resultCpuLoad;
            }

            set
            {
                resultCpuLoad = value;
            }
        }

        public int ResultMemoryUsage
        {
            get
            {
                return resultMemoryUsage;
            }

            set
            {
                resultMemoryUsage = value;
            }
        }

        public long StaticTotalMemory
        {
            get
            {
                return staticTotalMemory;
            }

            set
            {
                staticTotalMemory = value;
            }
        }

        public long StaticAvailableMemory
        {
            get
            {
                return staticAvailableMemory;
            }

            set
            {
                staticAvailableMemory = value;
            }
        }

        public int StaticCpuLoad
        {
            get
            {
                return staticCpuLoad;
            }

            set
            {
                staticCpuLoad = value;
            }
        }

        public int StaticMemoryUsage
        {
            get
            {
                return staticMemoryUsage;
            }

            set
            {
                staticMemoryUsage = value;
            }
        }

        public bool IsConnected
        {
            get
            {
                return isConnected;
            }

            set
            {
                isConnected = value;
            }
        }

        public long ResultTotalDiskSpace
        {
            get
            {
                return resultTotalDiskSpace;
            }

            set
            {
                resultTotalDiskSpace = value;
            }
        }

        public long ResultFreeDiskSpace
        {
            get
            {
                return resultFreeDiskSpace;
            }

            set
            {
                resultFreeDiskSpace = value;
            }
        }

        public int ResultDiskUsage
        {
            get
            {
                return resultDiskUsage;
            }

            set
            {
                resultDiskUsage = value;
            }
        }

        public string UpdateTime
        {
            get
            {
                return updateTime;
            }

            set
            {
                updateTime = value;
            }
        }
    }
}
